<?php include_once 'modal_achat.php';?>
<div class="panel panel-default">
    <div class="panel-heading"><h3>Rechercher</h3></div>
    <div class="panel-body">
        <form method="POST" action="<?php echo $BASE_URL ;?>search/page/">
            <table>
                <tr><th><label>Destination</Label></th><td>
                        Pays: <select id="inputPays" name="pays">
                                <option value="">peu m'importe</option>                           
                            <?php foreach ($formFilter["ListePays"] as $pays) {?>
                                <option value="<?php echo $pays->id; ?>" <?php echo $formFilter["pays"]==$pays->id?"selected=\"selected\"":""; ?> ><?php echo $pays->libelle; ?></option>                           
                            <?php }?>
                        </select> 
                        Ville: <select id="inputVille" name="ville">
                            <option value="">peu m'importe</option>
                            <?php foreach ($formFilter["ListeVilles"] as $ville) {?>
                                <option value="<?php echo $ville->id; ?>" <?php echo $formFilter["ville"]==$ville->id?"selected=\"selected\"":""; ?> ><?php echo $ville->libelle; ?></option>                           
                            <?php }?>ListeTypes
                        </select>
                </tr>
                <tr><th><label>Type séjour</Label></th><td>
                        <select id="inputType" name="type">
                            <option value="">peu m'importe</option>
                            <?php foreach ($formFilter["ListeTypes"] as $type) {?>
                                <option value="<?php echo $type->id; ?>" <?php echo $formFilter["type"]==$type->id?"selected=\"selected\"":""; ?> ><?php echo $type->libelle; ?></option>                           
                            <?php }?>
                        </select></td></tr>
                <tr><th><label>Date</Label></th>
                    <td>
                        <select id="inputAnnee" name="annee">
                            <option value="">peu m'importe</option>                            
                            <?php foreach ($formFilter["ListeAnnee"] as $annee) {?>
                                <option value="<?php echo $annee; ?>" <?php echo $formFilter["annee"]==$annee?"selected=\"selected\"":""; ?> ><?php echo $annee; ?></option>                           
                            <?php }?>                        </select>   
                        <select id="inputMois" name="mois" >
                            <option value="">peu m'importe</option>
                            <?php foreach ($formFilter["ListeMois"] as $numMois => $mois) {?>
                                <option value="<?php echo $numMois; ?>" <?php echo $formFilter["mois"]==$numMois?"selected=\"selected\"":""; ?> ><?php echo $mois; ?></option>                           
                            <?php }?>
                        </select>
                    </td>
                </tr>
                <!--<tr><th><label>durée</Label></th>
                    <td>
                        <select id="inputDuree" name="duree"  >
                            <option value="">peu m'importe</option>
                            <?php foreach ($formFilter["ListeDuree"] as $numDuree => $duree) {?>
                                <option value="<?php echo $numDuree; ?>" <?php echo $formFilter["duree"]==$numDuree?"selected=\"selected\"":""; ?> ><?php echo $duree; ?></option>                           
                            <?php }?>
                        </select> jours
                    </td>
                   
                </tr>-->
                <tr><th></th><td><input type="submit" value="Rechercher"/></td></tr>

            </table>
        </form>
    </div>
</div>
<p><?php echo $nbRes;?> résultats trouvés</p>
<div class="pagination"> <?php echo $this->pagination->create_links(); ?></div>
<div class="liste">
  <?php foreach ($lignesVoyages as $key => $lv) { 
      $v= $lv->getVoyage();
      $dateDep = new DateTime($lv->dateDep);
      ?>
  <div class="row">
        <div class="col-md-12"><?php echo $v->libelle; ?></div>
        <div class="col-md-4"><img width="300" src="<?php echo $BASE_URL.$v->getPhoto(); ?>" alt="<?php echo $v->libelle;?>" title="<?php echo $v->libelle;?>" ></div>
        <div class="col-md-8">
            <div class="row">
                <div class="col-md-5"><?php echo $dateDep->format("d/m/Y H:i"); ?></div>
                <div class="col-md-3"><?php echo $lv->dureeJours; ?> jours<br/> </div>
            </div>
            <div class="row">
                <div class="col-md-5"><?php echo $v->description; ?></div>
                <div class="col-md-3"><?php echo $lv->prixUnit ; ?>€</div>
            </div>
            <div class="row">
                <div class="col-md-5"><button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target="#achatModal" data-lignevoyage="<?php echo $lv->id; ?>" >Réserver</button></div>
            </div>
        </div>
  </div>
   <?php } ?>
</div>
<div class="pagination"> <?php echo $this->pagination->create_links() ; ?></div>
<script>
    $(document).ready(function(){
        
    });
</script>